package BasicThread;

public class PriorityOfThreads extends Thread {
	public void run() {
		System.out.println("runing...");
		System.out.println("Thread Names" +Thread.currentThread().getName());
		System.out.println(+Thread.currentThread().getPriority());
	}
	public static void main(String[] args) {
		PriorityOfThreads m1 = new PriorityOfThreads();
		PriorityOfThreads m2 = new PriorityOfThreads();
		PriorityOfThreads m3 = new PriorityOfThreads();
		System.out.println("start..");
		m1.setPriority(Thread.MIN_PRIORITY);//default priority =10
		m2.setPriority(Thread.MAX_PRIORITY);//default priority =1
		m3.setPriority(Thread.NORM_PRIORITY);//default priority =5
		m1.start();
		m2.start();
		m3.start();
	}

}
/** Each thread have a priority. Priorities are represented by a number between 1 and 10. In most cases, 
 * thread schedular schedules the threads according to their priority (known as preemptive scheduling).
 *  But it is not guaranteed because it depends on JVM specification that which scheduling it chooses.
 */